package com.miracle.services.impls;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.miracle.mapper.EggItemListMapper;
import com.miracle.services.IEggItemList;

@Service
public class EggItemListImpl implements IEggItemList {
	
	@Autowired
	private EggItemListMapper mapper;

	@Override
	public Map<String, String> getDataByPK(Map<String, String> map) {
		return mapper.getDataByPK(map);
	}

	@Override
	public List<Map<String, String>> getDataListByPK(String pk) {
		return mapper.getDataListByPK(pk);
	}

	@Override
	public boolean createOrSave(Map<String, String> map, boolean isCreate) {
		if(isCreate) {
			return mapper.create(map) == 1 ? true : false;
		} else {
		return mapper.update(map) == 1 ? true : false;
		}
	}
	
	@Override
	public boolean delete(String pk) {
		return mapper.delete(pk) == 1 ? true : false;
	}

	@Override
	public List<Map<String, String>> getOrd(String pk){
		return mapper.getDataListByPK(pk);
	}
	
	@Override
	public List<Map<String, String>> getOrdItem(String pk){
		return mapper.getDataListByPK(pk);
	}
}
